﻿using System.Web;

namespace Syx.Webapi.AppCode.Helpers {
    public static class CookieHelper {

        //public static void SetCookie(this HttpContextBase context, string keyName, string value, DateTime? expiry = null) {
        //    if (context.Response.HeadersWritten)
        //        return;
        //    // a null value is equivalent to deletion
        //    if (value == null) {
        //        context.Request.Cookies.Remove(keyName);
        //        context.Response.Cookies.Add(new System.Web.HttpCookie(keyName, "") { Expires = DateTime.Today.AddYears(-1) });
        //        return;
        //    }
        //    System.Web.HttpCookie newCookie = new System.Web.HttpCookie(keyName, value);
        //    if (expiry.HasValue)
        //        newCookie.Expires = expiry.Value;
        //    context.Response.Cookies.Add(newCookie);

        //}
    }
}
